	//
	//  SceneDelegate.m
	//  GaoDemo
	//
	//  Created by Gikki Ares on 2021/6/2.
	//

#import "SceneDelegate.h"
#import "JsRequestManagerTestController.h"
#import "HomeViewController.h"
#import "BaseNavigationViewController.h"
#import <JsUtilitySdk/JsUtilitySdk.h>
@interface SceneDelegate ()<
JsListViewControllerDelegate,
JsLoginViewControllerDelegate
>
{
	UINavigationController * _nc;
}

@end

@implementation SceneDelegate


- (void)scene:(UIScene *)scene willConnectToSession:(UISceneSession *)session options:(UISceneConnectionOptions *)connectionOptions {
		// Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`.
		// If using a storyboard, the `window` property will automatically be initialized and attached to the scene.
		// This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead).
	JsLoginViewController * vc = [JsLoginViewController new];
	vc.account = @"gaoyb";
	vc.password = @"123456";
	vc.delegate = self;
	UIBarButtonItem * item = [[UIBarButtonItem alloc]initWithTitle:@"About" style:UIBarButtonItemStylePlain target:self action:@selector(onClickAbout)];
	vc.navigationItem.rightBarButtonItem = item;
//	HomeViewController * vc = [HomeViewController new];
	

	self.window = [[UIWindow alloc]initWithWindowScene:(UIWindowScene *)scene];
	self.window.frame = UIScreen.mainScreen.bounds;
	BaseNavigationViewController * nc = [[BaseNavigationViewController alloc]initWithRootViewController:vc];
	_nc = nc;
	self.window.rootViewController = nc;
	[self.window makeKeyAndVisible];
	
	[self initComponent];
}

- (void)initComponent {
	[[JsLogManager sharedInstance]printLogFileDir];
}

- (void)onClickAbout {
	JsAboutViewController * vc = [[JsAboutViewController alloc]init];
	[_nc pushViewController:vc animated:YES];
}

	// MARK: Delegte
-(NSArray<JsListViewControllerModel *> *)jsListViewControllerSetDatasorce:(JsListViewController *)controller {
	return @[
		//		[[JsListViewControllerModel alloc] initWithIndex:@"01" title:@"FuncViewController" desc:@"This is just a demo"],
		[[JsListViewControllerModel alloc] initWithIndex:@"0601" title:@"JsRequestManagerTestController" desc:@"Test JsRequestManager\nTest JsRequestManager\nTest JsRequestManager\nTest JsRequestManager\n"],
		[[JsListViewControllerModel alloc] initWithIndex:@"0901" title:@"MenuViewTestController" desc:@"Test JsRequestManager"],
		[[JsListViewControllerModel alloc] initWithIndex:@"0902" title:@"NavMenuViewController" desc:@"Test JsMenuView"],
		[[JsListViewControllerModel alloc] initWithIndex:@"0903" title:@"MenuViewDefaultItemTestController" desc:@"Test JsMenuView with default JsMenuItemView"],
		[[JsListViewControllerModel alloc] initWithIndex:@"1901" title:@"CardListController" desc:@"Test JsTableView"],
		[[JsListViewControllerModel alloc] initWithIndex:@"2101" title:@"JsBottomInputBarController" desc:@"Test JsTableView"],
		[[JsListViewControllerModel alloc] initWithIndex:@"2102" title:@"JsBottomInputBarBetaController" desc:@"Test JsBottomInputBarBeta"],
		[[JsListViewControllerModel alloc] initWithIndex:@"13" title:@"DisplayTestController" desc:@"Test JsDisplayManager"],
		[[JsListViewControllerModel alloc] initWithIndex:@"27" title:@"TestMailViewController" desc:@"Test JsMailManager"],
		[[JsListViewControllerModel alloc] initWithIndex:@"31" title:@"Js_XXTeaManagerTestController" desc:@"Test XX Tea"],
		[[JsListViewControllerModel alloc] initWithIndex:@"32" title:@"JsMediaPickerViewController" desc:@"PickerMedia"],
		[[JsListViewControllerModel alloc] initWithIndex:@"33" title:@"StringValidatorViewController" desc:@"Validate String"],
		[[JsListViewControllerModel alloc] initWithIndex:@"34" title:@"OrientationManagerTestViewController" desc:@"String"],
		[[JsListViewControllerModel alloc] initWithIndex:@"35" title:@"SystemDataViewController" desc:@"String"],
	];
}

#pragma mark 4 Delegate
-(BOOL)jsLoginViewControllerWillLogin:(JsLoginViewController *)loginVc {
	JsListViewController * vc = [JsListViewController new];
	vc.delegate = self;
	vc.title = @"Home";
	BaseNavigationViewController * nc = [[BaseNavigationViewController alloc]initWithRootViewController:vc];
	nc.modalPresentationStyle = UIModalPresentationFullScreen;
	[_nc presentViewController:nc animated:YES completion:nil];
	return YES;
}

@end

